using System;
using System.Runtime.InteropServices;

namespace Fireball.ArchLinux.Pacman
{
    /// <summary>
    /// 
    /// </summary>
	public class ListApi
	{
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
		public delegate void FreeDelegate(object item);
		
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
		[DllImport("libalpm")]
		public extern static IntPtr alpm_list_new();
		
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
		[DllImport("libalpm")]
		public extern static void alpm_list_free(IntPtr list);
		
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        /// <param name="freeDelegate"></param>
		[DllImport("libalpm")]
		public extern static void alpm_list_free_inner(IntPtr list, FreeDelegate freeDelegate);	
		
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        /// <param name="data"></param>
        /// <returns></returns>
		[DllImport("libalpm")]
		public extern static IntPtr alpm_list_add(IntPtr list, object data);	
		
		//TODO: alpm_list_add_sorted
		
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
		[DllImport("libalpm")]
		public extern static int alpm_list_count(IntPtr list);	
		
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        /// <param name="n"></param>
        /// <returns></returns>
		[DllImport("libalpm")]
		public extern static IntPtr alpm_list_nth(IntPtr list,int n);		
		
        /// <summary>
        /// 
        /// </summary>
        /// <param name="entry"></param>
        /// <returns></returns>
		[DllImport("libalpm")]
		public extern static object alpm_list_getdata(IntPtr entry);		
	}
}
